package com.ruoyi.appVersion.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.appVersion.mapper.AppVersionMapper;
import com.ruoyi.appVersion.domain.AppVersion;
import com.ruoyi.appVersion.service.IAppVersionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 脚本版本Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-06
 */
@Service
public class AppVersionServiceImpl implements IAppVersionService 
{
    @Autowired
    private AppVersionMapper appVersionMapper;

    /**
     * 查询脚本版本
     * 
     * @param id 脚本版本主键
     * @return 脚本版本
     */
    @Override
    public AppVersion selectAppVersionById(Long id)
    {
        return appVersionMapper.selectAppVersionById(id);
    }

    /**
     * 查询脚本版本列表
     * 
     * @param appVersion 脚本版本
     * @return 脚本版本
     */
    @Override
    public List<AppVersion> selectAppVersionList(AppVersion appVersion)
    {
        return appVersionMapper.selectAppVersionList(appVersion);
    }

    /**
     * 新增脚本版本
     * 
     * @param appVersion 脚本版本
     * @return 结果
     */
    @Override
    public int insertAppVersion(AppVersion appVersion)
    {
        return appVersionMapper.insertAppVersion(appVersion);
    }

    /**
     * 修改脚本版本
     * 
     * @param appVersion 脚本版本
     * @return 结果
     */
    @Override
    public int updateAppVersion(AppVersion appVersion)
    {
        return appVersionMapper.updateAppVersion(appVersion);
    }

    /**
     * 批量删除脚本版本
     * 
     * @param ids 需要删除的脚本版本主键
     * @return 结果
     */
    @Override
    public int deleteAppVersionByIds(String ids)
    {
        return appVersionMapper.deleteAppVersionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除脚本版本信息
     * 
     * @param id 脚本版本主键
     * @return 结果
     */
    @Override
    public int deleteAppVersionById(Long id)
    {
        return appVersionMapper.deleteAppVersionById(id);
    }

    @Override
    public AppVersion getAppUpdate(String appName, int ver) {
        AppVersion appVersion=new AppVersion();
        appVersion.setAppName(appName);
        appVersion.setVer(ver);
        return appVersionMapper.selectAppVersionVer(appVersion);
    }
}
